package com.xujiang.mytool.adapter;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;

import com.xujiang.common_adapter.base.BaseRecyclerAdapterDelegate;
import com.xujiang.mytool.model.DirAndFileName;
import com.xujiang.mytool.R;

/**
 * @author xujiang
 * @version 2017-07-10 16:22
 */
public abstract class MainDeviceListAdapterDelegate<T extends DirAndFileName,H extends MainDeviceListViewHolder> extends
        BaseRecyclerAdapterDelegate<T,DirAndFileName,H> {

    public MainDeviceListAdapterDelegate(Context context) {
        super(context);
    }

    @NonNull
    @Override
    protected RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent) {
        View view = inflate(R.layout.file_list_item, parent);
        return onCreateMainDeviceListViewHolder(view);
    }

    @NonNull
    protected abstract RecyclerView.ViewHolder onCreateMainDeviceListViewHolder(View view);

    @Override
    public void onBindViewHolderItem(H holder, T item, int position) {
        holder.onHandle(item, position);
    }
}
